package mysql

import (
	"github.com/jinzhu/gorm"
)

type House struct {
	gorm.Model
	Name    string  `gorm:"type:varchar(10);not null"`
	Address string  `gorm:"type:varchar(20);not null"`
	Area    int     `gorm:"type:int(3);not null"`
	Price   float64 `gorm:"type:decimal(10,2);not null"`
}

func (h *House) Create() error {
	return DB.Create(&h).Error
}
func (h *House) Show(id int) error {
	return DB.Where("id = ?", id).Limit(1).Find(&h).Error
}
